<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <link href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
    <!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
    <script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
    <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
    <script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>

    <title>网上招聘系统</title>
    <style type="text/css">
        .error {
            color: Red;
            font-size: 13px;
            margin-left: 5px;
            padding-left: 16px;
        }
    </style>
</head>
<body>
<div class="container">
    <h2 class="page-header">企业信息修改(*为必填项)</h2>

    <form class="form-horizontal col-md-offset-4 col-md-4" id="fm" method="post" action="/updateInfo ">
        <div class="form-group">
            <div class="col-sm-2">
                <label>*公司名称：</label>
            </div>
            <input class="form-control col-sm-10" style="width: 200px" name="name" type="text" value="${company.name }"/>
        </div>

        <div class="form-group">
            <div class="col-sm-2">
                <label>*公司地址：</label>
            </div>
            <input  class="form-control col-sm-10" style="width: 200px" name="location" type="text" value="${company.location }"/>
        </div>

        <div class="form-group">
            <div class="col-sm-2">
                <label>*联系方式：</label>
            </div>
            <input class="form-control col-sm-10" style="width: 200px" name="phone" type="text" value="${company.phone }"/>
        </div>

        <div class="form-group">
            <div class="col-sm-2">
                <label>电子邮箱：</label>
            </div>
            <input class="form-control col-sm-10" style="width: 200px" name="email" type="text" value="${company.email }"/>
        </div>

        <div class="form-group">
            <div class="col-sm-2">
                <label>职位需求：</label>
            </div>
            <div  id="zhuanye"></div>
        </div>

        <div class="form-group">
            <div class="col-sm-2">
                <label>薪资待遇：</label>
            </div>
            <div  id="xinzi"></div>
        </div>

        <div class="form-group">
            <div class="col-sm-2">
                <label class="control-label">公司简介：</label>
            </div>
            <textarea class="col-sm-10 form-control" style="width: 200px;" name="tip">${company.tip }</textarea>
        </div>

        <input name="type" type="hidden" value="公司">

        <div class="col-sm-offset-2">
            <input class="btn btn-primary col-sm-2" type="submit" value="修改"/>
        </div>
    </form>
</div>


</body>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/common.js"></script>
<script type="text/javascript" src="js/WdatePicker.js"></script>
<script type="text/javascript" src="js/jquery.validate.min.js"></script>
<script type="text/javascript">
    $(function () {
        var $trade = $("<select name='trade' style='width:200px;height:30px;border:1px solid #C5D6E0'></select>");
        var $salary = $("<select name='salary' style='width:200px;height:30px;border:1px solid #C5D6E0'></select>");
        $("#zhuanye").append($trade);
        $("#xinzi").append($salary);
        var a = new Array();
        var b = new Array();
        var temp;
        a[0] = "软件工程师";
        a[1] = "会计";
        a[2] = "文员";
        a[3] = "客户经理";
        a[4] = "网站策划";
        a[5] = "平面设计师";

        b[0] = "3000-4000";
        b[1] = "4001-5000";
        b[2] = "5001-6000";
        b[3] = "6001-7000";
        b[4] = "7001-8000";
        var c_trade = "${company.trade}";
        var c_salary = "${company.salary}";
        $.each(a, function (index, value) {
            if (c_trade === value) {
                temp = a[0];
                a[0] = a[index];
                a[index] = temp;
            }
        });
        $.each(b, function (index, value) {
            if (c_salary === value) {
                temp = b[0];
                b[0] = b[index];
                b[index] = temp;
            }
        });
        // 添加选项
        $.each(a, function (index, value) {
            $("<option></option>").val(value).text(value).appendTo($($trade));
        });

        $.each(b, function (index, value) {
            $("<option></option>").val(value).text(value).appendTo($($salary));
        });
    });

    showRemind('input[type=text], textarea', 'placeholder');

    $("#fm").validate({
        rules: {
            name: {
                required: true
            },
            location: {
                required: true
            },
            phone: {
                required: true
            }
        },
        messages: {
            name: {
                required: "*不能为空！"
            },
            location: {
                required: "*不能为空！"
            },
            phone: {
                required: "*不能为空！"
            }
        }
    });
</script>

</html>
